package cn.lbj.forum.util;

import java.security.MessageDigest;

public class MD5 {

    public static String generateCode(String str) throws Exception{
        MessageDigest md5 = MessageDigest.getInstance("MD5");
        byte[] srcBytes = str.getBytes();
        md5.update(srcBytes);
        byte[] resultBytes = md5.digest();
        String res = new String(resultBytes);
        return res;
    }
}
